﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Brain
{
    public class VisualScriptCondition_Timed : VisualScriptNode_Condition
    {
        public int Tick { get; set; }

        public bool EndRestart { get; set; }

        public VisualScriptCondition_Timed(VisualScript script)
            : base(script)
        {
            this.Name = "Timed";
            Tick = 100;
            EndRestart = true;
        }

        private int Timer;
        public override void CheckCondition()
        {
            Timer += Engine.Instance.GameTime.ElapsedGameTime.Milliseconds;
            if (Timer > Tick)
            {
                Condition = true;
                if (EndRestart)
                {
                    Timer = 0;
                }
            }
            else
            {
                Condition = false;
            }
        }
    }
}
